package com.learm.lambda;

import java.util.ArrayList;
import java.util.List;

public class SeqDemo {

    private static int x=0,y=0;
    private static int a=0,b=0;

    public static void main(String[] args) throws InterruptedException {

        Thread t1 = new Thread(()->{
            a=1;
            x=b;
        });
        Thread t2 = new Thread(()->{
            b=1;
            y=a;
        });

        int i = getSize();
        int n = getSize();

        t1.start();
        t2.start();
        t1.join();
        t2.join();
        System.out.println("x="+x+"->y="+y);

    }

    public static int getSize(){
        List<String> list = new ArrayList<>();
        for (int i=0;i<1000000;i++){
            String s = "aaa"+i;
            list.add(s);
        }
        return list.size();
    }
}
